package com.baosight.sczx.zm.cc.service; 
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.threadlocal.UserSession;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.common.zm.basetools.StaticTools;
import com.baosight.sczx.common.zm.cInterface.Department;
import com.baosight.sczx.common.zm.cInterface.cs.InitialData;
import com.baosight.sczx.zm.cc.domain.ZMCCProduceproblemPenalty; 
/**
 * 生产问题处理---罚款记录
 */
public class ServiceZMCC14 extends ServiceEPBase {
	/**
	 * 初始化 
	 */
	public EiInfo initLoad(EiInfo inInfo) {
		inInfo.addBlock(EiConstant.resultBlock).set("showCount", "true");// 如果不加这个，翻页的统计和显示是错误的
		EiInfo outInfo = this.query(inInfo);
		return outInfo;
	}
	/**
	 * 查询
	 */
	public EiInfo query(EiInfo inInfo) {
		String fdPenaltyIds = inInfo.getString("fdPenaltyIds");
		EiInfo outInfo = inInfo;
		if (fdPenaltyIds != null && !fdPenaltyIds.toString().trim().equals("")) {
			String _temp[] = fdPenaltyIds.split(",");
			StringBuffer fdKeyIds = new StringBuffer();
			for (int i = 0; i < _temp.length; i++) {
				if (i == 0) {
					fdKeyIds.append("'" + _temp[i] + "'");
				} else {
					fdKeyIds.append(",'" + _temp[i] + "'");
				}
			}
			StaticTools.setQueryParameters(inInfo, "fdKeyIds", fdKeyIds, true);// 添加查询条件
			outInfo = super.query(inInfo, "ZMCCProduceproblemPenalty.query", new ZMCCProduceproblemPenalty());
		} else {
			outInfo.addBlock("result").setBlockMeta(new ZMCCProduceproblemPenalty().eiMetadata);
		}

		outInfo.addBlock(Department.getInstance().getMiningDepts("cmes.cp.department", "orgCode", "orgName", false, UserSession.getInSessionProperty("miningCode").toString()));// 部门
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cl.penaltyType"));

		return outInfo;
	}
}
